home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / Ioc_Reposition.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-30  |  1.9 KB  |  61 lines

  1. /* 
  2.  * Ioc_Reposition.c --
  3.  *
  4.  *    Source code for the Ioc_Reposition library procedure.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: Ioc_Reposition.c,v 1.2 88/07/29 17:08:46 ouster Exp $ SPRITE (Berkeley)";
  18. #endif not lint
  19.  
  20. #include <sprite.h>
  21. #include <fs.h>
  22.  
  23.  
  24. /*
  25.  *----------------------------------------------------------------------
  26.  *
  27.  * Ioc_Reposition --
  28.  *
  29.  *    Reposition the access position on a filesystem stream.  The next
  30.  *    read or write will start at the byte offset specified by the
  31.  *    combination of base and offset.  Base has three values corresponding
  32.  *    to the beginning of file, current position, and end of file.
  33.  *
  34.  * Results:
  35.  *    None.
  36.  *
  37.  * Side effects:
  38.  *    Sets the stream access position.
  39.  *
  40.  *----------------------------------------------------------------------
  41.  */
  42.  
  43. ReturnStatus
  44. Ioc_Reposition(streamID, base, offset, newOffsetPtr)
  45.     int streamID;        /* StreamID returned from Fs_Open */
  46.     int base;            /* IOC_BASE_ZERO for beginning of file,
  47.                  * IOC_BASE_CURRENT for the current position,
  48.                  * IOC_BASE_EOF for end of file. */
  49.     int offset;            /* Byte offset relative to base */
  50.     int *newOffsetPtr;        /* The resulting access position */
  51. {
  52.     register ReturnStatus status;
  53.     Ioc_RepositionArgs args;
  54.  
  55.     args.base = base;
  56.     args.offset = offset;
  57.     status = Fs_IOControl(streamID, IOC_REPOSITION, sizeof(Ioc_RepositionArgs),
  58.             (Address)&args, sizeof(int), (Address) newOffsetPtr);
  59.     return(status);
  60. }
  61.